﻿<Page x:Class="AzureDriverExplorer_Client.AddConnection"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        
        Title="Connection" Height="auto" Width="auto" x:Name="AddElement">

    <Page.Resources>
        <Style x:Key="StyleCancelBotton" TargetType="Button">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Margin" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Name="border" 
                            BorderThickness="1"                             
                            BorderBrush="Red" 
                            CornerRadius="3"
                           Background="#32E1DFCD">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="BorderBrush" Value="Black" />
                                <Setter TargetName="border" Property="Background" Value="#4BEA0000" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        
        <!-- This style is used for buttons, to remove the WPF default 'animated' mouse over effect -->
        <Style x:Key="StyleAddBotton" TargetType="Button">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Margin" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Name="border" 
                            BorderThickness="1"                             
                            BorderBrush="Green" 
                            CornerRadius="3"
                           Background="Transparent">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="BorderBrush" Value="Black" />

                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>
    <Grid  Background="#7C000000">
        <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
            <Grid.RowDefinitions>
                <RowDefinition Height="20" />
                <RowDefinition Height="auto"  />
            </Grid.RowDefinitions>
            <Grid Grid.Row="0"  Background="#FFDEDEDE">
                <Image HorizontalAlignment="Right" VerticalAlignment="Stretch"  Height="20" Width="20" Source="/AzureDriverExplorer_Client;component/Image/Cancel.png" />
                <Button   Height="20" Width="19" Style="{StaticResource StyleCancelBotton}"  HorizontalAlignment="Right" VerticalAlignment="Stretch"  Click="Close_popupAdd_Click" />
            </Grid>

            <Grid Grid.Row="1" Background="White" Height="353" Width="728">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Image Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"  Height="30" Width="30" Source="/AzureDriverExplorer_Client;component/Image/addList.png" />
                    <Button Grid.Column="0"   Click="ShowPopup" Height="30" Width="30" Style="{StaticResource StyleAddBotton}"  HorizontalAlignment="Left" VerticalAlignment="Center"  >
                    </Button>
                    <Image  Name="BackgroundImageLocalList" Grid.Row="1"   Margin="0,0,1,1" Source="/AzureDriverExplorer_Client;component/Image/view_text.png" OpacityMask="#3E000000" />
                    <ListView Background="#40F0F8FF" Grid.Row="1" x:Name="ListConnection" SelectionMode="Single">
                        <ListView.Resources>
                            <ContextMenu x:Key="resourceContextMenu" Opened="ListViewAzureMenu_Opened" >

                                <MenuItem   Header="Edit"  Tag="{Binding}"  Click="Edit_Open_Click"  >
                                    <MenuItem.Icon>
                                        <Image Source="/AzureDriverExplorer_Client;component/Image/addList.png" Width="16"  />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem   Header="Delete"  Tag="{Binding}"  Click="Delete_Click"  >
                                    <MenuItem.Icon>
                                        <Image Source="/AzureDriverExplorer_Client;component/Image/delete_file.png" Width="16"  />
                                    </MenuItem.Icon>
                                </MenuItem>
                            </ContextMenu>
                        </ListView.Resources>
                        <ListView.ItemContainerStyle>
                            <Style TargetType="{x:Type ListViewItem}">
                                <Setter Property="ContextMenu" Value="{StaticResource resourceContextMenu}" />
                            </Style>
                        </ListView.ItemContainerStyle>

                        <ListView.View>
                            <GridView AllowsColumnReorder="true"  ColumnHeaderToolTip="InfoFile"  >
                                <GridViewColumn Width="200" >
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate >
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="27" />
                                                    <ColumnDefinition Width="Auto" />
                                                </Grid.ColumnDefinitions>
                                                <Image Width="20" Grid.Column="0" Source="/AzureDriverExplorer_Client;component/Image/connections.png" />
                                                <TextBlock Grid.Column="1" VerticalAlignment="Center"  Text="{Binding AccountName}" />
                                            </Grid>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                    <GridViewColumnHeader Click="SortLocalClick" Tag="AccountName" Content="Account Name" x:Name="AccountName" />
                                </GridViewColumn>
                                <GridViewColumn Width="100" Header="Account Key" x:Name="AccountKey">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate >
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="Auto" />
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0" VerticalAlignment="Center"  Text="{Binding AccountKey}" Visibility="Hidden" />
                                                <TextBlock Grid.Column="0" VerticalAlignment="Center"  Text="XXXXXXXX" />
                                            </Grid>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>

                                </GridViewColumn>
                                <GridViewColumn Width="200" Header="Container Name" x:Name="ContainerName" >
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate >
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="Auto" />
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0" VerticalAlignment="Center"  Text="{Binding ContainerName}" />
                                            </Grid>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>

                                </GridViewColumn>
                                <GridViewColumn Width="200" Header="VHD Name" x:Name="VHDName" >
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate >
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="Auto" />
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0" VerticalAlignment="Center"  Text="{Binding VHDName}" />
                                            </Grid>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>

                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                </Grid>
            </Grid>
        </Grid>
        <Grid x:Name="popupAdd" Background="#7C000000" Visibility="Hidden">

                    <Grid Background="White" Height="200" Width="400" HorizontalAlignment="Center" VerticalAlignment="Center">

                        <Grid.RowDefinitions>
                            <RowDefinition Height="30" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="10" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid Grid.Row="0" Grid.ColumnSpan="2"  Background="#FFDEDEDE">
                            <TextBlock Text="Add Element" x:Name="AddElementTitle" VerticalAlignment="Center" FontWeight="Bold" FontSize="14"></TextBlock>
                        </Grid>
                        <TextBlock Grid.Column="0" Grid.Row="1"  VerticalAlignment="Center" x:Name="AccountNameTitle" Text="Account Name" />
                <TextBlock Grid.Column="0" Grid.Row="2" VerticalAlignment="Center"  x:Name="AccountKeyTitle" Text="Account Key" />
                <TextBlock Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" x:Name="ContainerNameTitle" Text="Container Name" />
                <TextBlock Grid.Column="0" Grid.Row="4" VerticalAlignment="Center" x:Name="VHDNameTitle" Text="VHD Name" />

                        <TextBox x:Name="txtAccountName" Grid.Column="1" Grid.Row="1" Width="280" BorderBrush="AliceBlue"></TextBox>
                <PasswordBox  x:Name="txtAccountKey" PasswordChar="*" Grid.Column="1" Grid.Row="2" Width="280" BorderBrush="AliceBlue"></PasswordBox >
                        <TextBox x:Name="txtContainerName" Grid.Column="1" Grid.Row="3" Width="280" BorderBrush="AliceBlue"></TextBox>
                        <TextBox x:Name="txtVHDName" Grid.Column="1" Grid.Row="4" Width="280" BorderBrush="AliceBlue"></TextBox>

                        <Grid  Grid.Row="6" Grid.ColumnSpan="2"  HorizontalAlignment="Center" Width="330">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="110" />
                                <ColumnDefinition Width="110" />
                                <ColumnDefinition Width="110" />
                            </Grid.ColumnDefinitions>
                            <Button x:Name="Add" Content="Add" Width="100" Grid.Column="0" Click="Add_Click"></Button>
                    <Button x:Name="AddClear" Content="Clear" Width="100" Grid.Column="1" Click="Clear_Add_Click"></Button>
                    <Button x:Name="AddCancel" Content="Cancel" Width="100" Grid.Column="2" Click="Cancel_Add_Click"></Button>
                        </Grid >
                    </Grid>

                </Grid>

                <Grid x:Name="popupEdit" Background="#7C000000" Visibility="Hidden">

                    <Grid Background="White" Height="200" Width="400" HorizontalAlignment="Center" VerticalAlignment="Center">

                        <Grid.RowDefinitions>
                            <RowDefinition Height="30" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="10" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid Grid.Row="0" Grid.ColumnSpan="2"  Background="#FFDEDEDE">
                    <TextBlock x:Name="EditElementTitle" Text="Edit Element" VerticalAlignment="Center" FontWeight="Bold" FontSize="14"></TextBlock>
                        </Grid>
                <TextBlock Grid.Column="0" Grid.Row="1"  VerticalAlignment="Center" x:Name="EditAccountNameTitle" Text="Account Name" />
                <TextBlock Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" x:Name="EditAccountKeyTitle" Text="Account Key" />
                <TextBlock Grid.Column="0" Grid.Row="3" VerticalAlignment="Center" x:Name="EditContainerNameTitle" Text="Container Name" />
                <TextBlock Grid.Column="0" Grid.Row="4" VerticalAlignment="Center" x:Name="EditVHDNameTitle" Text="VHD Name" />

                        <TextBox x:Name="txtAccountName_Edit" Grid.Column="1" Grid.Row="1" Width="280" BorderBrush="AliceBlue"></TextBox>
                        <TextBlock x:Name="labAccountName_Edit" Grid.Column="1" Grid.Row="1" Visibility="Hidden" />
                <PasswordBox  x:Name="txtAccountKey_Edit" PasswordChar="*" Grid.Column="1" Grid.Row="2" Width="280" BorderBrush="AliceBlue"></PasswordBox >
                        <TextBlock x:Name="labAccountKey_Edit" Grid.Column="1" Grid.Row="2" Visibility="Hidden" />
                        <TextBox x:Name="txtContainerName_Edit" Grid.Column="1" Grid.Row="3" Width="280" BorderBrush="AliceBlue"></TextBox>
                        <TextBlock x:Name="labContainerName_Edit" Grid.Column="1" Grid.Row="3" Visibility="Hidden"  />
                        <TextBox x:Name="txtVHDName_Edit" Grid.Column="1" Grid.Row="4" Width="280" BorderBrush="AliceBlue"></TextBox>
                        <TextBlock x:Name="labVHDName_Edit"  Grid.Column="1" Grid.Row="4" Visibility="Hidden" />

                        <Grid  Grid.Row="6" Grid.ColumnSpan="2"  HorizontalAlignment="Center" Width="330">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="110" />
                                <ColumnDefinition Width="110" />
                                <ColumnDefinition Width="110" />
                            </Grid.ColumnDefinitions>
                            <Button x:Name="Edit" Content="Edit" Width="100" Grid.Column="0" Click="Edit_Click"></Button>
                    <Button x:Name="EditClear" Content="Clear" Width="100" Grid.Column="1" Click="Clear_Edit_Click"></Button>
                    <Button x:Name="EditCancel" Content="Cancel" Width="100" Grid.Column="2" Click="Cancel_Edit_Click"></Button>
                        </Grid >
                    </Grid>

                </Grid>
          
    </Grid>
</Page>
